package com.weigee.ktv.v.adapter.rv;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.l.d.app.library.adapter.RvListAdapter;
import com.l.d.app.library.app.FragActivity;
import com.weigee.ktv.R;
import com.weigee.ktv.m.entity.WrapHolder;
import com.weigee.ktv.v.activity.ActivityUtil;
import com.weigee.ktv.v.activity.StandardActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 林德 on 2017/4/17 11:40.
 * <p/>
 */
public class SupermarketStoreAdapter extends RvListAdapter<String, SupermarketStoreAdapter.Holder> {
    @NonNull
    @Override
    public List<String> onCreateNewEmptyList() {
        return new ArrayList<>();
    }

    @Override
    public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
        final Context context = parent.getContext();
        final View itemView = LayoutInflater.from(context).inflate(R.layout.roomreservation_frag_rv_item, parent, false);
        return new Holder(itemView);
    }

    @Override
    public void onBindViewHolder(Holder holder, int position) {
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FragActivity.start(StandardActivity.class, v.getContext(), ActivityUtil.SUPERMARKET_SHOPPING_LIST);
            }
        });
    }

    @Override
    public int getItemCount() {
        // TODO: 2017/4/17 删除这个方法
        return 2;
    }

    static class Holder extends WrapHolder {
        private Holder(View itemView) {
            super(itemView);
        }
    }
}
